//
//  BlackTableViewCell.m
//  UniversalApp
//
//  Created by 志刚杨 on 2018/3/24.
//  Copyright © 2018年 voidcat. All rights reserved.
//

#import "BlackTableViewCell.h"

@implementation BlackTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    ViewRadius(_header, 15);
}

-(void)setModel:(BlackList *)model
{
    _model = model;
    [_header sd_setImageWithURL:safeurl(model.avatar) placeholderImage:emptyimage];
    
    _nickname.text = model.user_nickname;
}


-(void)addBlackList
{
    [[HUDHelper sharedInstance] syncLoading];
    NSString *url = [[CYURLUtils sharedCYURLUtils] makeURLWithC:@"personal_api" A:@"black_user"];
    NSMutableDictionary *param = [NSMutableDictionary dictionary];
    [param setObject:SafeStr(self.model.id) forKey:@"to_user_id"];
    
    [CYNET POSTv2:url parameters:param responseCache:^(id responseObject) {
        
    } success:^(id responseObject) {
        [[HUDHelper sharedInstance] syncStopLoadingMessage:ASLocalizedString(@"操作成功")];
        if(self.UnBackSuccess)
        {
            self.UnBackSuccess();
        }
    } failure:^(NSString *error) {
        [MBProgressHUD showTopTipMessage:error];
    } hasCache:NO];
    
}

//解除拉黑
- (IBAction)unBlack:(id)sender {
    [self addBlackList];
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
